package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsDeviceLock;
import com.econ.powercloud.ems.dal.mapper.EmsDeviceLockMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author : zjf
 * @Description : 设备闭锁配置DAO
 * @Date : 2023/10/7 11:38
 * @Modified by : zjf
 */
@Repository
public class EmsDeviceLockDAO extends ServiceImpl<EmsDeviceLockMapper, EmsDeviceLock> {

    public List<EmsDeviceLock> selectListByDeviceCodes(List<String> deviceCodes){
        LambdaQueryWrapper<EmsDeviceLock> wrapper = Wrappers.lambdaQuery();
        wrapper.in(CollectionUtils.isNotEmpty(deviceCodes),EmsDeviceLock::getDeviceCode,deviceCodes);
        return this.getBaseMapper().selectList(wrapper);
    }
}
